function [ metric, ths ]= norm_metric(mu_vec, sigma_vec)

if length(mu_vec)<2 || length(sigma_vec)<2 || length(mu_vec)~=length(sigma_vec)
    error('Invalid params.');
end

[mu idx] = sort(mu_vec);
sigma = sigma_vec(idx);

ths = zeros(length(mu)-1, 1);
perr = 0;
for i=1:length(mu)-1
    x = mu(i) + [0:0.01:1] * (mu(i+1)-mu(i));
    p = zeros(size(x));
    for j=1:i
        p = p+1-normcdf(x, mu(j), sigma(j));
    end
    for j=i+1:length(mu)
        p = p+normcdf(x, mu(j), sigma(j));
    end
    [pmin, idx] = min(p);
    ths(i) = x(idx);
    perr = perr + pmin;
end

metric = perr / length(mu);

end